<HTML>
<HEAD>
<TITLE>DefaultProjectName - HandleEvents</TITLE>
<script type="text/javascript">
  var relPathToCommmon = "../../common/";
  var relPathToHelpDir = "../../common/help/";
</script>
<script type="text/javascript" src="../../common/jsdyn.js" language="JavaScript"></script>
<script type="text/javascript" src="../../common/js.js" language="JavaScript"></script>
<script type="text/javascript" src="leftmenu.js" language="JavaScript"></script>
<script type="text/javascript">
  var toSearchPage     = "_search','../../search";
  Body1();
</script>
<div class="headerPage">HandleEvents</div>
<div class="path"><a href="#" OnMouseOver="link('','../../index',this)" class="pathLink">OOXlib</A><img src="../../common/path-arrow.gif" class="path-arrow"><a href="#" OnMouseOver="link('_dir','include0',this)" class="pathLink">include</A><img src="../../common/path-arrow.gif" class="path-arrow"><a href="#" OnMouseOver="link('_class','CDefaultEventHandler4032',this)" class="pathLink">CDefaultEventHandler</A><img src="../../common/path-arrow.gif" class="path-arrow"><span class="pathNonLink">HandleEvents</span></div>
<script type="text/javascript">
 Body2();
 BodyLeftMenuStart();
WriteLeftMenu("","","","");
 BodyLeftMenuEnd();
 Body3();
</script>
<span class="tabInActive"><a href="#" OnMouseOver="linkTab('_member','HandleEvents2849619859','_description',this)" class="tabLinkInActive">Description</a></span>
<span class="tabActive"><a href="#" OnMouseOver="linkTab('_member','HandleEvents2849619859','_source',this)" class="tabLinkActive">Source</a></span>
<span class="tabInActive"><a href="#" OnMouseOver="linkTab('_member','HandleEvents2849619859','_callgraph',this)" class="tabLinkInActive">Call Graph</a></span>
<script type="text/javascript">
 Body4();
</script>
<div class="contentAirTop"></div>
<div class="paragraph2NoTopPadding">Start Line: 52</div>
<pre class="codeExamples">
bool <a href="#" onMouseOver="link('_member','HandleEvents2849619859',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>bool&nbsp;&nbsp;HandleEvents&nbsp;&nbsp;(::XEvent & Event, IWindow * pWindow) const',CAPTION,'<strong>Brief description</strong><BR>Event handler.');" onMouseOut="return nd();">OOXlib::CDefaultEventHandler::HandleEvents</a>(::XEvent &amp;Event, IWindow *pWindow) const
                                                                             {
    if(NULL == pWindow) {
        return false;
    }
    switch(Event.type) {
        case Expose: {
            pWindow-&gt;OnExpose();
            break;
        } case ButtonPress: {
            pWindow-&gt;OnButtonPress(Event.xbutton.button, Event.xbutton.x, Event.xbutton.y);
            break;
        } case ButtonRelease: {
            pWindow-&gt;OnButtonRelease(Event.xbutton.button, Event.xbutton.x, Event.xbutton.y);
            break;
        } case EnterNotify: {
            pWindow-&gt;OnMouseEnter(Event.xcrossing.x, Event.xcrossing.y);
            break;
        } case LeaveNotify: {
            pWindow-&gt;OnMouseExit(Event.xcrossing.x, Event.xcrossing.y);
            break;
        } case MotionNotify: {
            pWindow-&gt;OnMouseMove(Event.xmotion.x, Event.xmotion.y);
            break;
        } case FocusIn: {
            pWindow-&gt;OnGotFocus();
            break;
        } case FocusOut: {
            pWindow-&gt;OnLostFocus();
            break;
        } case KeyPress:
        case KeyRelease: {
            char buffer[256];
            ::KeySym keysym;
            ::XComposeStatus status;
            // Become the KeySym from event.
            int count = ::XLookupString(&amp;Event.xkey, buffer, 255, &amp;keysym, &amp;status);
            buffer[count] = 0;
            if(KeyPress == Event.type) {
                pWindow-&gt;OnKeyPress(keysym);
            } else if(KeyRelease == Event.type) {
                pWindow-&gt;OnKeyRelease(keysym);
            };
            break;
        } case MapNotify: {
            pWindow-&gt;OnShow();
            break;
        } case UnmapNotify: {
            pWindow-&gt;OnHide();
            break;
        } case ClientMessage: {
            // If there is a 'WM_DELETE_WINDOW' message, return false.
            // It is necessary to break the event handling cycle and to close the application safely.
            // XInternAtom can generate BadAlloc and BadValue errors.
            ::Atom protocolsAtom = ::XInternAtom(<a href="#" onMouseOver="link('_member','m_pXServerConnection351871195',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>CXServerConnection *&nbsp;&nbsp;m_pXServerConnection ',CAPTION,'<strong>Brief description</strong><BR>');" onMouseOut="return nd();">m_pXServerConnection</a>-&gt;<a href="#" onMouseOver="link('_member','Get2399971253',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>virtual Display *&nbsp;&nbsp;Get&nbsp;&nbsp;() const',CAPTION,'<strong>Brief description</strong><BR>Returns a pointer to the display structure.');" onMouseOut="return nd();">Get</a>(), "WM_PROTOCOLS", false);
            ::Atom deleteWindowAtom = ::XInternAtom(<a href="#" onMouseOver="link('_member','m_pXServerConnection351871195',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>CXServerConnection *&nbsp;&nbsp;m_pXServerConnection ',CAPTION,'<strong>Brief description</strong><BR>');" onMouseOut="return nd();">m_pXServerConnection</a>-&gt;<a href="#" onMouseOver="link('_member','Get2399971253',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>virtual Display *&nbsp;&nbsp;Get&nbsp;&nbsp;() const',CAPTION,'<strong>Brief description</strong><BR>Returns a pointer to the display structure.');" onMouseOut="return nd();">Get</a>(), "WM_DELETE_WINDOW", false);
            if(Event.xclient.message_type == protocolsAtom &amp;&amp; Event.xclient.data.l[0] == static_cast&lt;long&gt;(deleteWindowAtom)) {
                return false;
            }
            break;
        } default: {
            break;
        }
    }
    return true;
}
</pre><div class="contentAirBottom"></div>
<script type="text/javascript">
 Body5();
Statistics("","","","","");
 Body6();
SetPageTab('_member','_source');
</script>
